/**
 * Copyright (c) 2014-2015, Suredy technology Co., Ltd. All rights reserved.
 * @author ZhangMaoren 
 * @since 2015年12月7日
 * @version 0.1
 */
package com.suredy.app.detection.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;


/**
 * @author ZhangMaoren
 * 臭和味检测
 */
@Entity
@Table(name = "T_DETECTION_SMELLANDTASTE")
public class SmellandTasteEntity extends Detection{
	
	@OneToMany(mappedBy = "smellAndTaste", cascade={CascadeType.ALL}, targetEntity = SmellandTasteItemEntity.class) 
	@OrderBy("sampleId")
	private List<SmellandTasteItemEntity> items;
	/**
	 * 
	 */
	private static final long serialVersionUID = -5027312756167019104L;

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#getContent()
	 */
	@Override
	public String getDetectionName() {
		return detectionName;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#setContent(java.lang.String)
	 */
	@Override
	public void setDetectionName(String detectionName) {
		this.detectionName = detectionName;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#getMethod()
	 */
	@Override
	public String getMethod() {
		return method;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#setMethod(java.lang.String)
	 */
	@Override
	public void setMethod(String method) {
		this.method = method;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#getStandards()
	 */
	@Override
	public String getStandards() {
		return standards;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#setStandards(java.lang.String)
	 */
	@Override
	public void setStandards(String standards) {
		this.standards = standards;
	}

	
	/**
	 * @return the items
	 */
	public List<SmellandTasteItemEntity> getItems() {
		return items;
	}

	
	/**
	 * @param items the items to set
	 */
	public void setItems(List<SmellandTasteItemEntity> items) {
		for (SmellandTasteItemEntity item : items) {
			if (!this.equals(item.getSmellAndTaste())) {
				item.setSmellAndTaste(this);
			}
		}
		this.items = items;
	}
	
	

}
